clear
rng(23)

outer_counter = 1;
repeats = 100;
num_comps = 10;
num_moments = 5;
parpool('local',num_comps)

%%% THE CODE BELOW RUNS THE MAIN SIMULATION USING THE ESTIMATED PARAMETERS
%%% TO REPRODUCE THE TARGET MOMENTS. THE PARAMETERS WERE CALIBRATED USING
%%% THE GRID SEARCH ALGORITHM IN run_annealing_para.m - though any standard
%%% Matlab gridsearch algorithm would do for that.
while counter <= repeats
parfor computer_num = 1:num_comps
params = [0.0658	0.0282	0.0863	1.5638	4.5124	0.6827];
temp_data = steady_state_simulation_search(params);
iteration_data = iteration_data+temp_data'; 
end
counter = counter+1
end

sim_moments = iteration_data./(repeats*num_comps);
growth_US = sim_moments(1);
growth_OECD = sim_moments(2);
relative_wage = sim_moments(3)+1;
employment_share_entrants = sim_moments(4);
export_share_revenues_US = sim_moments(5);
std_firm_revenue_worker = sqrt(sim_moments(6));
trade_elasticity = sim_moments(7);
